package acm.蓝桥杯模拟;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class 这题目真的又困又无聊 {
    static int a;
    static int b;
    static int c;
    static int min;

    public static void main(String[] args) {
        Reader sc = new Reader();
        int rest = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        min = Math.min(a, Math.min(b, c));
//        System.out.println(fun(rest));
        System.out.println(dpFun(rest));
    }

    public static long fun(int rest) {
        if (rest < min) {
            return 0;
        }
        long fun = 0;
        if (rest == a || rest == b || rest == c) {
            fun+=1;
        }
        fun += fun(rest - a);
        fun += fun(rest - b);
        fun += fun(rest - c);
//        return fun(rest-a)+fun(rest-b)+fun(rest-c);
        return fun;
    }
    public static long dpFun(int rest){
        long[] dp=new long[rest+1];
        dp[a]=1;
        dp[b]=1;
        dp[c]=1;
        for (int i = 1; i < dp.length; i++) {
            if (i-a>=0){
                dp[i]+=dp[i-a];
            }
            if (i-b>=0){
                dp[i]+=dp[i-b];
            }
            if (i-c>=0){
                dp[i]+=dp[i-c];
            }
        }
        return dp[rest];
    }
    static class Reader {
        private StringTokenizer in=new StringTokenizer("");
        private BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        public String next(){
            hasNext();
            return in.nextToken();
        }
        public boolean hasNext(){
            if (!in.hasMoreTokens()) {
                String line = null;
                try {
                    line = reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line==null){
                    return false;
                }
                in=new StringTokenizer(line);
            }
            return true;
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public String nextLine(){
            try {
                in=new StringTokenizer("");
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
